package com.joysuch.wwyt.patrol.controller;


import com.joysuch.wwyt.core.common.ajax.ResultBean;
import com.joysuch.wwyt.patrol.service.PatrolRecordService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.web.bind.annotation.RestController;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author heqifeng
 * @since 2022-03-03
 */
@RestController
@RequestMapping("/patrol/patrol-record")
@Api(tags = "智能巡检-检查记录")
public class PatrolRecordController {

    @Autowired
    private PatrolRecordService recordService;

    @GetMapping("app-check-point-record-list")
    @ApiOperation(value = "app检查点查询(记录)")
    public ResultBean appGetCheckPointRecord(Long taskId) {
        return ResultBean.success(recordService.appGetCheckPointByTaskId(taskId));
    }

    @GetMapping("app-check-device-record-list")
    @ApiOperation(value = "app检查项目查询(记录)")
    public ResultBean appGetCheckDeviceRecord(Long recordId) {
        return ResultBean.success(recordService.getDeviceRecordByRecordId(recordId));
    }

    @GetMapping("get-snapshot")
    @ApiOperation("地图快照")
    public ResultBean getSnapshot(Long taskId, String checkUserNames) {
        return ResultBean.success(recordService.getSnapshot(taskId, checkUserNames));
    }

    @GetMapping("delete-record")
    @ApiOperation("删除任务记录")
    @RequiresPermissions("patrol:task:delete")
    public ResultBean deleteRecord(Long taskId) {
        return ResultBean.success(recordService.deleteTaskRecord(taskId));
    }


}

